﻿/*
Copyright (c) 2011 Vratislav Cermak (vratacermak@gmail.com)
 
This file is part of TeachMe Project. See http://code.google.com/p/teach-me for more information.
 
TeachMe is an open source project. Using of TeachMe is free of charge.
It is distributed under GNU General Public License version 3 (GPLv3).
GPLv3 can be found at http://www.gnu.org/licenses/gpl.html.
 
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TeachMe.Application
{
    internal class MessageEventArgs : EventArgs
    {
        public Message Message { get; set; }
    }

    internal class MessageHandler : NativeWindow
    {
        public EventHandler<MessageEventArgs> OnMessage;

        public MessageHandler()
        {
            CreateHandle(new CreateParams());
        }

        protected override void WndProc(ref Message msg)
        {
            EventHandler<MessageEventArgs> handler = OnMessage;

            if (handler != null)
            {
                handler(this, new MessageEventArgs { Message = msg });
            }

            base.WndProc(ref msg);
        }
    }
}
